package edu.zime.iot.dao;

import edu.zime.iot.entity.Course;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface CourseMapper
{
    @Select("SELECT * FROM course")
    public List<Course> getAll();

    @Insert("INSERT INTO course(lesson, teacher) VALUES(#{lesson}, #{teacher})")
    public int addCourse(Course course);

    @Update("UPDATE course SET lesson=#{lesson}, teacher=#{teacher} WHERE id= #{id}")
    public int updateCourse(Course course);

    @Delete("DELETE FROM course WHERE id= #{id}")
    public int deleteCourseById(int id);

    @Select("SELECT * FROM course WHERE id= #{id}")
    public Course getCourseById(int id);
}
